Guild api updates - #121
Merged
Merged
Conversation
sn-netlag
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Guild API updates: list query params, leaderboards, inventory, resolve, and aggregates
Extends the read API for guild dashboards and third-party clients. Every list endpoint gains a common set of query params, and new endpoints expose the indexer-maintained
api_*projections, denomination metadata, object resolution, and time-bucketed stats.List endpoints (CatalogReadController)
All
/api/*/list/...and/api/*/all/page/{page}routes now accept:limitupdated_sinceupdated_atafter_id(updated_at, id); replaces the page offsetsince_seqseqfor a single planet's activity feedinclude_totaltotal(count of the filtered relation)include_metameta.height(source block height)orderval.descis_destroyed0/1filter for struct listsSupport is declared per endpoint. A param an endpoint cannot honour returns 400
<param>_unsupportedrather than being silently ignored, so a client paging a feed is told when its cursor did nothing.ApiResponseContentDtonow serialisestotalandmetaonly when set, so existing consumers see an unchanged shape.New endpoints
GET /api/leaderboard/{kind}for player, guild, reactor, substation, provider, with allowlistedorderandlimit. Amounts are served as_pstrings.GET /api/inventory/denom/{denom}/page/{page},GET /api/inventory/owner/{owner_type}/{owner_id}GET /api/guild-bank,GET /api/guild-bank/{guild_id}/history?bucket=1h|1dGET /api/denompublishes the unit contract (base denoms, exponents, guild denoms with branded symbols, state suffixes,_pprecision rule) so clients stop hardcoding conversions.GET /api/resolve?q=resolves an object key, an address, or a name search across players, guilds and substations.GET /api/objects?ids=batch-fetches up to 25 keys.GET /api/stat/{metric}/aggregate/range?object_type=&start_time=&end_time=&bucket=returns a per-bucket sum, average, population and sample count. Samples are change-triggered, so each bucket carries every object's last known value forward (LOCF) with a bounded scan; a naive per-bucket aggregate would describe only the objects that happened to move.bucketandlimiton the existing/api/stat/.../rangeendpoint, allowing a 30-day window when bucketed./api/player/count,/api/player/active/count?window_blocks=,/api/struct/count?is_destroyed=,/api/struct/status/counts,/api/planet/count,/api/fleet/count,/api/work/count/api/player/{id}/power,/api/player/power/at-risk?limit=, both sourced fromview.playerso the milliwatt arithmetic stays in one place./api/provider/market(alpha-equivalent rate via guild bank ratio, committed capacity) and/api/agreement/owner/{owner}/market(blocks and escrow remaining)./api/planet-raid/all/page/{page},/api/planet-raid/status/{status}/page/{page},/api/planet-activity/stats,/api/ledger/stats,/api/block/api/grid/attribute-type/{type}/object-type/{object_type}/page/{page}Existing endpoints
_pprecision columns beside the display values. Roster alpha now sums liquid, infused and defusing holdings on both scales.ApiSqlQueryTraitgainsqueryOneStamped/queryAllStamped, which stampmeta.heightfromapi_refresh_statefor a named model or fromcurrent_blockotherwise.ObjectKeyTraitandObjectTypesreplace the object-key parsing that lived inStatReadManager.Review fixes (verified against the live database)
guild_meta.denomis jsonb (an exponent-to-symbol map), so/api/denomnow lists guild denoms fromstructs.guildand exposes the symbols as ascale.grid.object_typeis varchar, not thestructs.object_typeenum; the grid filter no longer casts.after_idcursor compared the tuple in the wrong direction for same-timestamp rows and is now correct forupdated_at DESC, id ASCwithNULLS LAST.since_seqis restricted to the by-planet activity feed, sinceseqcounts per planet.resolve?q=are escaped; the leaderboard discord join cannot duplicate rows.Tests
New unit tests drive the managers through a mocked DBAL connection and assert on the composed SQL: cursor shape, unsupported-param rejection, allowlisted ordering, precision column naming, denom contract, object-key prefix ordering, and routing precedence for literal segments over
{id}patterns.125 tests, 367 assertions, all passing. Every new manager method was also exercised against the running testnet database.